﻿@page "/"

<PageTitle>Index</PageTitle>

<div class="row">
    <div class="col-4">
        <EditForm EditContext="Context">
            <DataAnnotationsValidator />
            @if (!string.IsNullOrEmpty(Error))
            {
                <div class="alert alert-danger mb-3">@Error</div>
            }
            <div class="row">
                <label class="col-2 col-form-label">手机号</label>
                <div class="col-10">
                    <InputText @bind-Value="Model.Mobile" class="form-control" />
                </div>
            </div>
            <div class="row mt-2">
                <div class="col-6">
                    <InputText @bind-Value="Model.Code" placeholder="验证码" class="form-control" />
                </div>
                <div class="col">
                    <div class="d-block">
                        <button class="btn btn-primary w-100" disabled="@StartCountdown" @onclick="GetCode">
                            @if (StartCountdown)
                            {
                                <text>剩余@(Countdown)重新获取</text>
                            }
                            else
                            {
                                <text>获取验证码</text>
                            }
                        </button>
                    </div>
                </div>
            </div>
        </EditForm>
    </div>
</div>